//
//  APIURLStrings.swift
//  GhostWorld
//
//  Created by Kam on 2018/4/2.
//  Copyright © 2018 LKGood. All rights reserved.
//

import Foundation

struct APIURLStrings {
    private static let serverBaseURL = "https://app3.guiyingclub.net" // remote
    //  private static let serverBaseURL = "http://192.168.0.109:3000" // localhost
    private static let version = "/api/v3"
    
    static let imagePrefix = serverBaseURL
    static let vipCategoryCoverPrefix = "\(serverBaseURL)/uploads/vip_c"
    
    private static let html = "uploads/html"
    private static let contents = "contents"
    private static let listeners = "listeners"
    private static let members = "members"
    private static let coins = "coins"
    private static let audios = "audios"
    private static let codes = "codes"
    private static let helps = "helps"
    private static let information = "information"
    
    static let requestSMS = "\(serverBaseURL)\(version)/\(listeners)/request_sms"
    static let systemLogin = "\(serverBaseURL)\(version)/\(listeners)/sys_login"
    static let platformLogin = "\(serverBaseURL)\(version)/\(listeners)/platform_login"
    static let systemRegister = "\(serverBaseURL)\(version)/\(listeners)/sys_register"
    static let logout = "\(serverBaseURL)\(version)/\(listeners)/logout"
    static func uploadPlaytime(audioIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(listeners)/audios/\(audioIdentifier)/play_time"
    }
    static let getTotalPlaytime = "\(serverBaseURL)\(version)/\(listeners)/total_play_time"
    //获取vip有效时间
    static let getVipValidtime = "http://api.guiyingclub.com/index.php?s=/Api/App/getVipInfo"
    //修改用户信息
    static let userInfoCheck = "http://api.guiyingclub.com/index.php?s=/Api/App/userInfoCheck"
    //获取验证码
    static let messageSend = "http://api.guiyingclub.com/index.php?s=/Api/App/messageSend"
    //鬼影重重
    static let getAlbumLists = "http://api.guiyingclub.com/index.php?s=/Api/App/getAlbumLists"
    
    static let checkIn = "\(serverBaseURL)\(version)/\(listeners)/check_in"
    static let isCheckedInToday = "\(serverBaseURL)\(version)/\(listeners)/is_checked_in_today"
    static let totalCheckInTime = "\(serverBaseURL)\(version)/\(listeners)/total_check_in_time"
    
    static let allIAPs = "\(serverBaseURL)\(version)/\(contents)/all_iaps"
    static let allGroups = "\(serverBaseURL)\(version)/\(contents)/all_groups"
    static let gwRecommendations = "\(serverBaseURL)\(version)/\(contents)/home_recommendations"
    static let gwCategories = "\(serverBaseURL)\(version)/\(contents)/category"
    static let seasons = "\(serverBaseURL)\(version)/\(contents)/seasons"
    
    static func albumsOfGroupWithPurchaseInfo(identifier: Int, listenerIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/group/\(identifier)/albums/listener/\(listenerIdentifier)"
    }
    static func albumsOfGroup(identifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/group/\(identifier)/albums"
    }
    
    static func albumPurchaseState(identifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(listeners)/album/\(identifier)/purchase_status"
    }
    static func albumDetail(identifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/album/\(identifier)"
    }
    static let getExchangedContents = "\(serverBaseURL)\(version)/\(contents)/exchanges"
    static func getiOSPurchasedContents(iapIdentifiers: String) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/iap/\(iapIdentifiers)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
    }
    
    static let readers = "\(serverBaseURL)\(version)/\(contents)/readers"
    static func getReaderAlbums(readerIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/readers/\(readerIdentifier)/albums"
    }
    static let writers = "\(serverBaseURL)\(version)/\(contents)/writers"
    static func getWriterAlbums(writerIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/writers/\(writerIdentifier)/albums"
    }
    
    static let vipTipHTML = "\(serverBaseURL)/\(html)/vip.html"
    static let vipLatest = "\(serverBaseURL)\(version)/\(members)/latest"
    static let vipCategory = "\(serverBaseURL)\(version)/\(members)/category"
    static func vipAllWithRootGroup(groupIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(members)/all_with_groups/\(groupIdentifier)"
    }
    
    static func search(keyword: String) -> String {
        return "\(serverBaseURL)\(version)/\(contents)/search/\(keyword)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
    }
    
    static let allTokens = "\(serverBaseURL)\(version)/\(coins)/all"
    static func purchaseToken(tokenIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(coins)/\(tokenIdentifier)/purchase"
    }
    static let tokenHistory = "\(serverBaseURL)\(version)/\(coins)/history"
    static let exchangeContent = "\(serverBaseURL)\(version)/\(coins)/exchange"
    static func getTokenAlipayURL(tokenIdentifier: Int) -> String {
        return "\(serverBaseURL)\(version)/\(coins)/\(tokenIdentifier)/alipay_order"
    }
    
    static let codeSetting = "\(serverBaseURL)\(version)/\(codes)/setting"
    static let codeConsume = "\(serverBaseURL)\(version)/\(codes)/consume"
    
    static func getAudioRate(audioID: Int) -> String {
        return "\(serverBaseURL)\(version)/\(audios)/\(audioID)/rate"
    }
    static func sendAudioRate(audioID: Int) -> String {
        return "\(serverBaseURL)\(version)/\(listeners)/\(audios)/\(audioID)/rate"
    }
    
    static let getHelpTitles = "\(serverBaseURL)\(version)/\(helps)/all_titles"
    static func getHelpDetails(helpID: Int) -> String {
        return "\(serverBaseURL)\(version)/\(helps)/\(helpID)/detail"
    }
    
    static let getAgreement = "\(serverBaseURL)\(version)/\(information)/agreement"
    static let getTokenRechargeInstruction = "\(serverBaseURL)\(version)/\(information)/ios_recharge"
}
